﻿<#include "include/_meta.html">
<title>客户信用值列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 管理员管理 <span
            class="c-gray en">&gt;</span> 管理员列表 <a class="btn btn-success radius r"
                                                   style="line-height:1.6em;margin-top:3px"
                                                   href="javascript:location.replace(location.href);" title="刷新"><i
                class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">

        客户名称：
        <input type="text" class="input-text" style="width:250px" id="custormerName" name="">
        手机号:
        <input type="text" class="input-text" style="width:250px" id="custormerPhone" name="">

        <button type="submit" class="btn btn-success" id="searchCustomer" name=""><i class="Hui-iconfont">&#xe665;</i>
            搜用户
        </button>
    </div>
    <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">

	<table id="CustomerCreditTable" class="table table-border table-bordered table-bg table-hover">
		<thead>
			<tr>
				<th scope="col" colspan="9">客户信用值列表</th>
			</tr>
			<tr class="text-c">
				<th width="50"><input type="checkbox" name="useritem" value=""></th>
				<th width="170">客户姓名</th>
				<th width="200">手机号</th>
				<th width="300">身份证号码</th>
				<th width="150">信用值</th>
				<th width="200">信用值变化</th>
				<th width="200">变化原因</th>
				<th width="70">操作</th>
			</tr>
		</thead>

		<tbody>

  		<tr class="text-c" v-for="(it,index) in result">
            <th width="40"><input type="checkbox" name="useritem" value=""></th>
			<td hidden="hidden">{{it.custormerId}}</td>
            <td>{{it.custormerName}}</td>
            <td>{{it.custormerPhone}}</td>
            <td>{{it.custormerIdCard}}</td>
            <td>{{it.custormerCreditValue}}</td>
	   		<td>{{it.custormerChangeCreditValue}}</td>
			<td>{{it.custormerCausesChanges}}</td>
            <td>
               <a href="#" @click="editEvent(it.custormerId)">编辑</a>
            </td>
        </tr>

        <tr>
            <td colspan="9">
                <div id="pagenav"></div>
            </td>
        </tr>

    </tbody>

    </table>
    </div>
    </table>

    <#include "include/_footer.html">
</body>
</html>

<script type="text/javascript">

    var app = new Vue({
        el: "#CustomerCreditTable",
        data: {
            result: []
        }
    });

    var getAllCustomerCredit = function (curr) {
        $.ajax({
            type: 'post',
            dataType: 'json',
            url: '/getAllCustomerCredit',
            data: {
                pageNum: curr || 1,
                pageSize: 5,
                custormerName: $("#custormerName").val(),
                custormerPhone: $("#custormerPhone").val()
            },
            success: function (msg) {
                app.result = msg.custerList;
                laypage({
                    cont: "pagenav",
                    pages: msg.total,
                    skin: "#DB7000",
                    first: "第一页",
                    last: "最后一页",
                    curr: curr || 1,
                    jump: function (obj, first) {
                        if (!first) {
                            getAllCustomerCredit(obj.curr);
                        }
                    }
                });
            }
        });
    };

    getAllCustomerCredit();

    $("#searchCustomer").click(function () {
        getAllCustomerCredit();
    });

    //编辑页面
    var editEvent = function (custormerId) {
        layer.open({
            type: 2,
            title: '修改客户信用值',
            fix: false,
            maxmin: true,
            shadeClose: true,
            area: ['800px', '550px'],
            content: '/customerCreditgetById?custormerId=' + custormerId,
            end: function () {
                getAllCustomerCredit();
            }
        });
    };
</script>